package com.bit.www;

public class Dog {
    //变量、属性、字段
    private String name;
    private int age;
    private String color;
    //构造方法
    public Dog(String name,int age,String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }
    //获取和更改对象的方法
    public String getName() {
        return this.name;
    }
    public int getAge() {
        return this.age;
    }
    public String getColor() {
        return this.color;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public void setColor(String color) {
        this.color = color;
    }
    //成员方法、行为
    public void eat() {
        System.out.println(this.name + "正在吃狗粮....");
    }
    public void barks() {
        System.out.println(this.name + "正在汪汪汪叫....");
    }
    //对象的打印方法 Ait + Ins +toString();
    public String toString() {
        return "姓名：" + this.name + "   年龄：" + this.age + "   毛色：" + this.color;
    }

}
